﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RegProductoUp.aspx.cs" Inherits="AppGisena.Presentacion.Up.RegProductoUp" %>

   <%@ Import Namespace="System.Collections.Generic"%>

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<!DOCTYPE html>
<html>

<body>
 
               <form id="form1" runat="server">
    <ext:ResourceManager runat="server" />
    
    
  
    
    <ext:FormPanel 
        ID="FormPanPrinc" 
        runat="server"
        Title="REGISTRO DE UNIDADES PRODUCTIVAS"
        Width="600" 
        Height="800"        
        BodyPadding="10"
        DefaultAnchor="100%"
         Layout="AutoLayout"
         StyleSpec="position:absolute;top: 10%;left: 30%;width: 77px; height: 78px;margin-top: -39px; margin-left: -39px;"
        UI="Success">

      <%--Form Panel Principal  --%>
                

        <Items>
            
            <ext:FieldContainer 
                runat="server" 
                MsgTarget="Side"
                CombineErrors="true"
                FieldLabel="Codigo Up"
                Layout="HBoxLayout">
                  <Items>
                        <ext:NumberField   ID="Txt_Cod_Up" runat="server" MaxLeng="20"  AllowBlank="false" Width="150" />
                          <ext:Toolbar     runat="server"       Flex="1"     Flat="true">   
                        <Items>
                            <ext:Button ID="Button7" runat="server" Text="Buscar..." Icon="Zoom" >
                                   <DirectEvents>
                                   <Click OnEvent="Btn_BuscarUP_Click">
                                   <EventMask ShowMask="true" Msg="Buscando..." MinDelay="500" />
                                  </Click>
                           </DirectEvents>
                         </ext:Button>
                            
                        </Items>
                    </ext:Toolbar>
                  </Items>

                  </ext:FieldContainer>

        </Items>

           <Items>

         <%--Contenedor datos basicos de la up sofia  --%>

            <ext:FieldSet 
                runat="server"
                Title="Detalle de la Up"
                DefaultAnchor="100%">
                <Defaults>
                    <ext:Parameter Name="labelWidth" Value="89" Mode="Raw" />
                </Defaults>
                <Items>
               
                      

                     <ext:FieldContainer 
                runat="server" 
                FieldLabel="Nombre Up" 
                AnchorHorizontal="100%" 
                Layout="HBoxLayout">                                       
                <Items>
                    <ext:TextField ID ="Txt_Nomb_UP2" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="true"/>                    
                </Items>
            </ext:FieldContainer>

                 


                    <%-- Numero de actas sofia plus al registro ya seleccionado --%>

                <ext:FieldContainer 
                runat="server" 
                FieldLabel="Cod. Centro" 
                AnchorHorizontal="100%" 
                Layout="HBoxLayout">                                       
                <Items>
                      
                      <ext:TextField ID="Txt_Cod_Cent_Form2" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="true"/>                  
                </Items>
            </ext:FieldContainer>


             <%-- Numero de la ficha --%>

                <ext:FieldContainer 
                runat="server" 
                FieldLabel="No. Ficha" 
                AnchorHorizontal="100%" 
                Layout="HBoxLayout">                                       
                <Items>
                    <ext:TextField   ID="Txt_NFicha_UP2" runat="server" Width="250" Margins="0 3 0 0" ReadOnly="true"/>                    
                </Items>
            </ext:FieldContainer>

                </Items>




            </ext:FieldSet>
        </Items>


   
        


        <Items>


         <%--Contenedor tab panel pricipal --%>
    
                    <ext:FieldSet 
                runat="server"
                Title="Registrar productos Unidad Productiva"
                Collapsible="true"
                DefaultAnchor="100%">
              <Items>
                     <ext:FieldContainer 
                                     runat="server" 
                                     MsgTarget="Side"
                                     CombineErrors="true"
                                     FieldLabel="Cod/Nomb. del Producto"
                                     Layout="HBoxLayout">


                        <Items>
 <%-- Select Box Producto linta Desplegable--%>  

                     <ext:ComboBox   ID="cmbproduct"
                runat="server" 
                DisplayField="Nomb_Prod" 
                ValueField="Id_Prod"
                TypeAhead="false"
                Width="300"
                PageSize="10"
                HideBaseTrigger="true"
                MinChars="0"
                TriggerAction="Query"
                         EmptyText="Nombre o Codigo del Producto">
                <ListConfig  LoadingText="Buscando...">
                    <ItemTpl runat="server">
                        <Html>
                            <div class="search-item">
							    <h3><span>{Id_Prod_Final} </span>{Nomb_Prod}</h3>
							    {Descrip_Prod}
						    </div>
                        </Html>
                    </ItemTpl>
                </ListConfig>
                <Store>
                    <ext:Store runat="server" AutoLoad="false">
                        <Proxy>
                            <ext:AjaxProxy Url="Plants.ashx">
                                <ActionMethods Read="POST" />
                                <Reader>
                                    <ext:JsonReader Root="plants" TotalProperty="Id_Prod" />
                                </Reader>
                            </ext:AjaxProxy>
                        </Proxy>
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="Id_Prod_Final" />
                                    <ext:ModelField Name="Nomb_Prod" />
                                    <ext:ModelField Name="Descrip_Prod" />
                                    <ext:ModelField Name="Id_prod_base" Type="Int" />
                                    <ext:ModelField Name="Id_tp_Prod" Type="Int" />
                                </Fields>
                            </ext:Model>                            
                        </Model>
                    </ext:Store>
                </Store>
            </ext:ComboBox>    

                          <ext:Button ID="BtnBusqCodigo" runat="server" Text="Por Codigo">
                                <DirectEvents>
                                   <Click OnEvent="Btn_BtnBusqCodigo">
                                  </Click>
                           </DirectEvents>
                            </ext:Button>   
                   
                        </Items>
  </ext:FieldContainer>

               </Items> 
                        
                        
                        
                <Items>          
                        
            <ext:FieldContainer 
                                     runat="server" 
                                     MsgTarget="Side"
                                     CombineErrors="true"
                                     FieldLabel="Es principal? "
                                     Layout="HBoxLayout">
                          <Items>
                                  <ext:SelectBox
                                    ID="Slb_principal"
                                 runat="server"     >             
                                 <Items>
                                  <ext:ListItem Text="SI" Value="True" />
                                 <ext:ListItem Text="NO" Value="False" />
                                
                                 </Items>
                    
                              </ext:SelectBox>
                              </Items>
                         </ext:FieldContainer>
             </Items>                
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                                 
         <%--Boton Guardar Producto --%>
 <Items>  
             <ext:Toolbar     runat="server"       Flex="1"     Flat="true">   
                       
                        <Items>
                            <ext:Button ID="Btn_Registrar_Product" runat="server" Text="Guardar" Icon="Add" >
                                   <DirectEvents>
                                   <Click OnEvent="Btn_Registrar_Prod">
                                  </Click>
                           </DirectEvents>
                         </ext:Button>
                            
                        </Items>
                        </ext:Toolbar>

     </Items>  

 <Items>
 
                    
                    <ext:GridPanel
                    runat="server" 
                    Header="false"
                    Border="false">                         
                    <Store>
                         <%--Data Grid Producto Ofertado --%>
                        <ext:Store ID="StrGrid_Prod_Ofer" runat="server" PageSize="10">
                            <Model>
                                <ext:Model runat="server" IDProperty="Id_Prod_Final">
                                    <Fields>
                                       
                                        <ext:ModelField Name="Id_Prod_Ofert" Type="Int" />
                                        <ext:ModelField Name="Id_Prod_Final" Type="Int" />
                                        <ext:ModelField Name="Nomb_Prod" Type="String" />
                                        <ext:ModelField Name="Descrip_Prod" Type="String" />
                                        <ext:ModelField Name="Principal" Type="Boolean" />
                                        <ext:ModelField Name="Nombre" Type="String" />
                                        
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel runat="server">
                        <Columns>
                             <ext:Column runat="server" 
                                Text="ID" 
                                Width="30" 
                                Sortable="true" 
                                DataIndex="Id_Prod_Ofert" 
                                />
                            <ext:Column runat="server" 
                                Text="COD_PRODUCT" 
                                Width="60" 
                                Sortable="true" 
                                DataIndex="Id_Prod_Final" 
                                />
                            <ext:Column runat="server" 
                                Text="NOMBRE" 
                                Width="80" 
                                Sortable="true" 
                                DataIndex="Nomb_Prod"
                                Flex="1" 
                                />
                            <ext:Column runat="server" 
                                Text="DESCRIPCION" 
                                Width="40" 
                                Sortable="true" 
                                DataIndex="Descrip_Prod"
                                Flex="1" 
                                />
                            <ext:Column runat="server" 
                                Text="ES PRINCIPAL?" 
                                Width="40" 
                                Sortable="true" 
                                DataIndex="Principal"
                                Flex="1" 
                                />
                            <ext:Column runat="server" 
                                Text="TIPO_PRODUCTO" 
                                Width="40" 
                                Sortable="true" 
                                DataIndex="Nombre"
                                Flex="1" />
                                
                           
                            <ext:Column runat="server" 
                               
                                Width="20" 
                                Sortable="true" 
                                Flex="1"   >
                             <Commands>
                             <ext:ImageCommand CommandName="Edit" Icon="Delete" Text="Borrar">
                                <ToolTip Text="Edit" />
                             </ext:ImageCommand>
                             </Commands>
                             <Listeners>
                             <Command  Handler="#{DirectMethods}.BorrarProducto(record.data.Id_Prod_Ofert);" />
                             </Listeners>
                              </ext:Column>



                        </Columns>
                    </ColumnModel>
                    <View>
                        <ext:GridView runat="server" LoadMask="false" />
                    </View>
                    <Features>
                        <ext:GridFilters runat="server" Local="true">
                            <Filters>
                                <ext:NumericFilter DataIndex="ID" />
                                <ext:StringFilter DataIndex="Name" />
                                <ext:DateFilter DataIndex="Start">
                                    <DatePickerOptions runat="server" TodayText="Now" />
                                </ext:DateFilter>
                                <ext:DateFilter DataIndex="End">
                                    <DatePickerOptions runat="server" TodayText="Now" />
                                </ext:DateFilter>                        
                                <ext:BooleanFilter DataIndex="Completed" />
                            </Filters>
                        </ext:GridFilters>
                    </Features>
                    <BottomBar>
                        <ext:PagingToolbar 
                            runat="server" 
                            DisplayInfo="true"
                            DisplayMsg="Mostrando Productos {0} - {1} of {2}"
                            />
                    </BottomBar>
                </ext:GridPanel>
                    
                     
              </Items>




                        </ext:FieldSet>

        </Items>
    

   
          


        
        
</ext:FormPanel>

   

     
     
     
     
           
      </form>


</body>
</html>